program C4_1;
var
	f:array[0..27] of integer;
	c:char;
	i,j,k,l:integer;
begin
for i:=0 to 25 do f[i]:=0;
repeat
	read(c);
	if c in ['A'..'Z'] then
		begin
		inc( f[ord(c) - ord('A')] );
		end;
	until c='.';
j:=-1;
for i:=0 to 25 do begin
	if f[i] > j then j:=f[i];
	end;

for i:=j downto 1 do begin
	for k:=0 to 25 do begin
		if f[k]=i then for l:=1 to f[k] do write( chr(ord('A')+k) );
		end;
	end;
writeln; {eol}
end.
